package com.py.pythink.controller;

import com.alibaba.fastjson.JSON;
import com.py.pythink.bo.SellerQueryBo;
import com.py.pythink.config.RedisKeyConfig;
import com.py.pythink.config.SystemConfig;
import com.py.pythink.dao.SellersDao;
import com.py.pythink.entity.Sellers;
import com.py.pythink.entity.User;
import com.py.pythink.service.intf.SellersService;
import com.py.pythink.third.JedisUtil;
import com.py.pythink.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;

import javax.servlet.http.HttpServletRequest;


@Api(value="",tags="实现对Sellers的操作")
@RestController
@CrossOrigin
@RequestMapping("/api/sellers/")
public class SellersController {
    @Autowired
    private SellersService service;
    @Autowired
    private SellersDao dao;


    @GetMapping("queryaddress.do")
    @ApiOperation(value = "",notes = "模糊查询地址")
    public R queryByAddress(String address){
        return R.ok(service.queryByAddress(address));
    }

    @GetMapping("querycity.do")
    @ApiOperation(value = "",notes = "查询地区")
    public R queryByCity(String city){
        return R.ok(service.queryByCity(city));
    }

    @GetMapping("queryprice.do")
    @ApiOperation(value = "",notes = "根据总价查询")
    public R queryByPrice(int min,int max){
        return R.ok(service.queryByPrice(min,max));
    }

    @GetMapping("queryunivalence.do")
    @ApiOperation(value = "",notes = "根据单价查询")
    public R queryByUnivalence(int min,int max){
        return R.ok(service.queryByUnivalence(min,max));
    }

    @GetMapping("queryhousetype.do")
    @ApiOperation(value = "",notes = "根据户型查询")
    public R queryByHousetype(int housetype) {
        return R.ok(service.queryByHousetype(housetype));
    }


    @GetMapping("sortunivalence.do")
    @ApiOperation(value = "",notes = "根据单价进行排序查询")
    public R sortByUnivalence(int type){
        return R.ok(service.sortByUnivalence(type));
    }

    @GetMapping("sortyopentime.do")
    @ApiOperation(value = "",notes = "根据开盘时间进行排序查询")
    public R sortByFtime(int type){
        return R.ok(service.sortByFtime(type));
    }

    @GetMapping("querybymore.do")
    @ApiOperation(value = "",notes = "根据价格或类型进行查询")
    public R queryByMore(SellerQueryBo bo){
        return R.ok(service.queryByMore(bo));
    }
}
